//找出所有子集的异或总和再求和
//测试链接： https://leetcode.cn/problems/sum-of-all-subset-xor-totals/
public class SubsetXORSum {
    public int ans = 0;
    public int subsetXORSum(int[] nums) {
        dfs(nums,0,0);
        return ans;
    }
    public void dfs(int[] nums, int path, int pos) {
        if(pos == nums.length) {
            ans += path;
            return;
        }
        dfs(nums, path, pos+1);
        path ^= nums[pos];
        dfs(nums, path, pos+1);
    }
}
